﻿using Anke.SHManage.MSSQLDAL;
using Microsoft.Reporting.WebForms;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Anke.SHManage.Web.Reports
{ 
    public partial class LS_EntryListDetailPrintWebForm : System.Web.UI.Page
    {
        private string reportName;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                InitPage();
            }
            else
            {
                reportName = Convert.ToString(ViewState["reportName"]);
            }

        }
           private void InitPage()
        {
            reportName = Request.QueryString["ReportName"];
            ViewState["reportName"] = reportName;
            BindReportDataSource();
        }
        protected void BindReportDataSource()
        {            
            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = Server.MapPath(@"~/Reports/LS_XEntryList.rdlc");
            Microsoft.Reporting.WebForms.ReportParameter ed = new Microsoft.Reporting.WebForms.ReportParameter("EntryCode", reportName);
            this.ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { ed });
            LSDAL dal = new LSDAL();

            DataTable dt7 = dal.Get_LS_XEntryDetailByCode(reportName);
            this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSetForLS_XEntryList", dt7));
            this.ReportViewer1.LocalReport.Refresh();
        }
    }
}